/*   1:    */ package com.atomikos.beans;
/*   2:    */ 
/*   3:    */ import java.io.PrintStream;
/*   4:    */ import java.lang.reflect.Constructor;
/*   5:    */ import java.lang.reflect.Field;
/*   6:    */ import java.lang.reflect.Method;
/*   7:    */ import java.util.ResourceBundle;
/*   8:    */ import javax.swing.JFrame;
/*   9:    */ import javax.swing.JOptionPane;
/*  10:    */ 
/*  11:    */ public class MemberChooser
/*  12:    */ {
/*  13:    */   Class clazz_;
/*  14:    */   ClassInspector inspector_;
/*  15:    */   JFrame parent_;
/*  16:    */   ResourceBundle messages_;
/*  17:    */   
/*  18:    */   public MemberChooser(JFrame parent, Class clazz)
/*  19:    */   {
/*  20: 59 */     this.clazz_ = clazz;
/*  21: 60 */     this.parent_ = parent;
/*  22: 61 */     this.inspector_ = new ClassInspector(clazz);
/*  23: 62 */     this.messages_ = ResourceBundle.getBundle("com.atomikos.beans.MemberChooserResourceBundle");
/*  24:    */   }
/*  25:    */   
/*  26:    */   public void setMemberFilter(MemberFilter filter)
/*  27:    */   {
/*  28: 67 */     this.inspector_.setMemberFilter(filter);
/*  29:    */   }
/*  30:    */   
/*  31:    */   public MemberFilter getMemberFilter()
/*  32:    */   {
/*  33: 72 */     return this.inspector_.getMemberFilter();
/*  34:    */   }
/*  35:    */   
/*  36:    */   public Method showMethodsDialog(Method selectedMethod)
/*  37:    */   {
/*  38: 83 */     Method[] methods = this.inspector_.getMethods();
/*  39: 84 */     Method ret = (Method)JOptionPane.showInputDialog(this.parent_, this.messages_.getString("methodsDialogTitle"), this.messages_.getString("methodsDialogMessage"), 3, null, methods, selectedMethod);
/*  40:    */     
/*  41:    */ 
/*  42:    */ 
/*  43:    */ 
/*  44:    */ 
/*  45:    */ 
/*  46: 91 */     return ret;
/*  47:    */   }
/*  48:    */   
/*  49:    */   public Field showFieldsDialog(Method selectedField)
/*  50:    */   {
/*  51:103 */     Field[] fields = this.inspector_.getFields();
/*  52:104 */     Field ret = (Field)JOptionPane.showInputDialog(this.parent_, this.messages_.getString("fieldsDialogTitle"), this.messages_.getString("fieldsDialogMessage"), 3, null, fields, selectedField);
/*  53:    */     
/*  54:    */ 
/*  55:    */ 
/*  56:    */ 
/*  57:    */ 
/*  58:    */ 
/*  59:111 */     return ret;
/*  60:    */   }
/*  61:    */   
/*  62:    */   public Constructor showConstructorsDialog(Constructor selectedConstructor)
/*  63:    */   {
/*  64:123 */     Constructor[] methods = this.inspector_.getConstructors();
/*  65:124 */     Constructor ret = (Constructor)JOptionPane.showInputDialog(this.parent_, this.messages_.getString("constructorsDialogTitle"), this.messages_.getString("constructorsDialogMessage"), 3, null, methods, selectedConstructor);
/*  66:    */     
/*  67:    */ 
/*  68:    */ 
/*  69:    */ 
/*  70:    */ 
/*  71:    */ 
/*  72:131 */     return ret;
/*  73:    */   }
/*  74:    */   
/*  75:    */   public static void main(String[] args)
/*  76:    */     throws Exception
/*  77:    */   {
/*  78:136 */     if (args.length == 0) {
/*  79:136 */       throw new Exception("Missing arg: class name");
/*  80:    */     }
/*  81:137 */     String className = args[0];
/*  82:138 */     Class clazz = Class.forName(className);
/*  83:139 */     MemberChooser chooser = new MemberChooser(null, clazz);
/*  84:140 */     Method m = chooser.showMethodsDialog(null);
/*  85:141 */     if (m != null) {
/*  86:141 */       System.out.println(m.toString());
/*  87:    */     }
/*  88:142 */     Field f = chooser.showFieldsDialog(null);
/*  89:143 */     if (f != null) {
/*  90:143 */       System.out.println(f.toString());
/*  91:    */     }
/*  92:144 */     Constructor c = chooser.showConstructorsDialog(null);
/*  93:145 */     if (c != null) {
/*  94:145 */       System.out.println(c.toString());
/*  95:    */     }
/*  96:    */   }
/*  97:    */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\atomikos-util\3.7.0\atomikos-util-3.7.0.jar
 * Qualified Name:     com.atomikos.beans.MemberChooser
 * JD-Core Version:    0.7.0.1
 */